$(function(){
        $("#testFile").change(function () {  
            run(this, function (data) {  
                $('.testImg:last').attr('src', data);
                $('.testImg:last').parent().prepend('<div class="close_img"><img src="/Public/img/close.png"></div>');
                $('.imgs').append('<div class="imgindex"><img class="testImg lastupimg" src="/public/img/1add.png" ></div>'); 
            });  

        });  
        $("#btnTest").click(function () {  
            $.ajax({  
                url: "/usercenter/testbaseaction",  
                type: "post",  
                dataType: "json",  
                data: {  
                    "content": $("#testArea").val(),  
                },  
                async: false,  
                success: function (result) {  
                    if (result.Code == 200) {  
                        alert(result.Data);  
                    } else {  
                    }  
                }  
            });  
        });
        function run(input_file, get_data) {  
            if (typeof (FileReader) === 'undefined') {  
                alert("1");  
            } else {  
                try {
                    var file = input_file.files[0];
                    if (!/image\/\w+/.test(file.type)) {  
                        alert("不可以上传视频");  
                        return false;  
                    }  
                    var reader = new FileReader();  
                    reader.onload = function () {  
                        get_data(this.result);  
                    }  
                    reader.readAsDataURL(file);  
                } catch (e) {  
                    alert('3' + e.toString())  
                }  
            }  
        }  

})